package com.timber.util;

import java.awt.*;
import java.awt.event.*;
import java.util.Date;
import java.util.Locale;
import pv.jfcx.JPVDate;
import pv.jfcx.JPVDatePlus;


public class SLDatePlus extends JPVDatePlus
{
  private static final Font	DEFAULT_FONT = new Font( "Dialog", 1, 11 );

  public SLDatePlus()
  {
      this( true );
  }

  public SLDatePlus( java.util.Date dt )
  {
      this( false );
      setDate( dt );
  }

  public SLDatePlus( boolean to_day )
  {
    try
    {
      jbInit();
      if( to_day == true )
      {
	  setDate( new Date() );
	  setAllowNull( false );
      }
    }
    catch(Exception ex)
    {
      ex.printStackTrace();
    }
  }

  private void jbInit() throws Exception
  {
    updateLocale( Locale.ENGLISH );
    setFormat( JPVDate.DMY );
    setMonthFormat( JPVDate.MMM );
    setSeparator( "-" );
    setShowCentury( true );
    setCloseOnDoubleClick( false );

    addFocusListener( new FocusAdapter()
      {
	public void focusGained( FocusEvent fe )
	{
	  setCaretPosition( 0 );
	}
      } );
  }
}
